package cn.com.chengmandian.bike;

import com.github.binarywang.wxpay.bean.payscore.WxPayScoreResult;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.PayScoreService;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.PayScoreServiceImpl;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;

public class TestApplication {

    public void excute() throws WxPayException {
        WxPayService payService = new WxPayServiceImpl();
        //调用初始化config接口
        WxPayConfig payConfig = new WxPayConfig();
        String keyPath = this.getClass().getClassLoader().getResource("apiclient_key.pem").getPath();
        String certPath = this.getClass().getClassLoader().getResource("apiclient_cert.pem").getPath();
        payConfig.setMchId("1559148091");
        payConfig.setServiceId("00003001000000775889051203725118");
        payConfig.setMchKey("kidakkoKOK54Dolfkldsa4562341ssJK");
        payConfig.setAppId("wx4bcf818aa2b8c755");
        payConfig.setServiceId("00003001000000775889051203725118");
        payConfig.setApiV3Key("kidakkoKOK54Dolfkldsa4562341ssJK");
        payConfig.setPrivateKeyPath(keyPath);
        payConfig.setPrivateCertPath(certPath);
        payConfig.setCertSerialNo("2B7E4D3D8CD9BD701EA85640A59FC4C89D27A0F5");
        payConfig.setUseSandboxEnv(false);
        payService.setConfig(payConfig);
        PayScoreService payScoreService = new PayScoreServiceImpl(payService);

        WxPayScoreResult response = payScoreService.cancelServiceOrder("PO-1801100146777976832","自行支付");
    }

    public static void main(String[] args) throws WxPayException {
       new TestApplication().excute();
    }
}
